package com.web.bdo.util;

import java.util.ArrayList;

import org.apache.struts.util.LabelValueBean;

import com.web.bdo.User;
import com.web.util.obj.dao.CountryListDao;
import com.web.util.string.StringUtil;

public class UserDetails extends ArrayList<LabelValueBean> {

	User user;
	
	public UserDetails(User user) {
		super();
		this.user = user;
		
		String[] sexes = {"Male", "Female"};
		String countryName= CountryListDao.getCountryName(user.getCountry());
		String pw = StringUtil.mask(user.getPassword(), '*');
			
		add(new LabelValueBean("Name", user.getFirstName() + " " + user.getLastName()));
		add(new LabelValueBean("E-mail address", user.getEmailAddress()));
		add(new LabelValueBean("Password", pw));
		add(new LabelValueBean("Sex, Age", sexes[user.getSex()] + ", " + user.getAge() + " years old"));
		add(new LabelValueBean("Country", countryName));
	}
	
}
